<?php 
$v_cate_type="CATE";
if(isset($_REQUEST['cate_type'])){
	$v_cate_type=$_REQUEST['cate_type'];
}
switch($v_cate_type) {
	case "CATE";
		$v_title = CONST_QA_LIST_ALL_CATE_TITLE;
		$v_content_qa_lable  = CONST_QA_CONTENT_LABEL;
		$v_qa_empty = CONST_QA_EMPTY_QA_BY_CATE_LABEL;
		$v_dsp_list_cate = "block";
		$v_cate_id =0;
	break;
	case "IDEA";
		$v_title = CONST_QA_LIST_IDEA_TITLE;
		$v_content_qa_lable  = CONST_QA_CONTENT_IDEA_LABEL;
		$v_qa_empty = "";
		$v_dsp_list_cate = "none";
		$v_cate_id =115;
	break;
	case "RESULT";
		$v_title = CONST_QA_LIST_RESULT_TITLE;
		$v_content_qa_lable  = CONST_QA_CONTENT_LABEL;
		$v_qa_empty = "";		
		$v_dsp_list_cate = "none";
		$v_cate_id =116;
	break;
	case "OTHER";
		$v_title = CONST_QA_LIST_OTHER_TITLE;
		$v_content_qa_lable  = CONST_QA_CONTENT_LABEL;
		$v_qa_empty = "";		
		$v_dsp_list_cate = "none";
		//--$v_cate_id =114;
		$v_cate_id =131;
	break;
	case "REGISTER";
		$v_title = CONST_QA_LIST_REGISTER_TITLE;
		$v_content_qa_lable  = CONST_QA_CONTENT_REGISTER_LABEL;
		$v_qa_empty = "";		
		$v_dsp_list_cate = "none";
		$v_cate_id =117;
	break;
}

$v_form_name="f_dsp_single_qa_question_for_sending";
$v_url = "index.php";
if(isset($_REQUEST['agency_id'])){
	$v_agency_id = $_REQUEST['agency_id'];
}else{
	$v_agency_id = 0;
}
$v_qa_question_content = ''; 
$v_fuseaction_back = ''; 
$v_back = 1; 
// Goi thu tuc xu ly khi xoa cac file moi them (chua submit)
$v_goto_url_for_delete_file = "javascript:delete_row_qa(document.all.tr_line_new,document.f_dsp_single_qa_question_for_sending.chk_file_attach_new_id,document.f_dsp_single_qa_question_for_sending.hdn_deleted_new_file_id_list);";
// Goi thu tuc de them moi dong
$v_goto_url_for_add_file = "javascript:add_row(document.all.tr_line_new," . CONST_QA_FILE_MAXLENGTH .");";

$v_sender_name = "";
$v_address = "";
$v_email = "";
if (isset($_SESSION['citizen_id']) && !is_null($_SESSION['citizen_id'])){
	$v_sender_name = $_SESSION['arr_single_citizen']['FULL_NAME'];
	$v_address = $_SESSION['arr_single_citizen']['ADDRESS'];
	$v_email = $_SESSION['arr_single_citizen']['EMAIL'];
}
?>
<table width="100%"cellpadding="0" cellspacing="0">
	<tr>
		<td class="normal_title"><?php echo $v_title; ?></td>
	</tr>
</table>
<!--bang chua tieu de cua form-->
<table width="100%" class="form_table1" cellpadding="0" cellspacing="0">
	<col width="20%"><col width="30%"><col width="20%"><col width="30%">
	<tr>
		<form action="index.php" method="post" enctype= "multipart/form-data" name="<? echo $v_form_name;?>">
		<input type="hidden" name="fuseaction" value="DISPLAY_SINGLE_QA_QUESTION_FOR_SENDING">
		<input type="hidden" name="hdn_fusecaction" value="<? echo $v_fuseaction_back;?>">
		<input type="hidden" name="hdn_qa_cate_id" value="<?php echo $v_qa_cate_id;?>">	
		<input type="hidden" name="hdn_cate_id" value="<?php echo $v_cate_id;?>">	
		<input type="hidden" name="hdn_agency_id" value="<?php echo $v_agency_id;?>">
		<input type="hidden" name="hdn_content_qa" value="<?php echo $v_content_qa;?>">		
		<input type="hidden" name="hdn_back" value="<?php echo $v_back;?>">		
		<input type="hidden" name="cate_type" value="<?php echo $v_cate_type;?>">
		<!---Luu ID cua cac file da co nhung da bi xoa-->
		<input type="hidden" name="hdn_deleted_exist_file_id_list" value="">
		<!---Luu ID cua cac file moi them nhung da bi xoa-->
		<input type="hidden" name="hdn_deleted_new_file_id_list" value="">
		<script language="JavaScript"> 
			<!-- start Javascript-->
			_editor_url = "../../isa-lib/js-editor/";                     
			var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);//Doan nay khoi tao de dung editor
			if (win_ie_ver >= 5.5) {
			   document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js" language="JavaScript"></scr' + 'ipt>');
			}else{ 
				document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); 
			}		
		</script>	
	</tr>
    <!--Bang chua cac Thong tin-->  
	<tr style="display:<?php echo $v_dsp_list_cate;?> ">
		<td class="normal_label" style="display:none"><?php echo CONST_CATE_LABEL;?><small class="normal_starmark">*</small></td>
		<td colspan="10" style="display:none">
			<select class="normal_selectbox" name="sel_cate" style="width:100%" optional = "true" message = "<?php echo CONST_CATE_MESSAGE; ?>" onChange="sel_onclick_qa(f_dsp_single_qa_question_for_sending.hdn_cate_id,f_dsp_single_qa_question_for_sending.sel_cate);">
				<option id="" value="">--<?php echo CONST_CATE_NAME_LABEL;?>--</option>
				<?php echo _generate_select_option($arr_all_cate,'0','0','2', $v_cate_id);?>
			</select>
		</td>
	</tr>
	<tr>
		<td class="normal_label" style="display:none"><?php echo CONST_AGENCY_LABEL;?><small class="normal_starmark">*</small></td>
		<td colspan="10" style="display:none">
			<select class="normal_selectbox" name="sel_agency" style="width:100%" optional="<?php echo CONST_AGENCY_OPTIONAL;?>" message = "<?php echo CONST_AGENCY_MESSAGE; ?>" onChange="sel_onclick_qa(f_dsp_single_qa_question_for_sending.hdn_agency_id,f_dsp_single_qa_question_for_sending.sel_agency);alert(this.value);">
				<option id="" value="">--<?php echo CONST_AGENCY_NAME_LABEL;?>--</option>
				<?php echo _generate_select_option($arr_all_agency,'1','0','2', $_ISA_OWNER_CODE);?>
			</select>
		</td>  
	</tr>
	<tr>
		<td class="normal_label"><?php echo CONST_QA_SENDER_NAME_LABEL;?><small class="normal_starmark">*</small></td>
		<td colspan="10">
			<input type="text"  name="txt_qa_sender_name" class="normal_textbox" style="width:99%" value="<?php echo $v_sender_name;?>" optional="<? echo CONST_QA_SEND_NAME_OPTIONAL; ?>"  message="<?php echo CONST_QA_SEND_NAME_MESSAGE;?>" onKeyDown="change_focus(document.f_dsp_single_qa_question_for_sending,this)">
		</td>
	</tr>
	<tr>
		<td class="normal_label"><?php echo CONST_QA_SENDER_ADDRESS_LABEL;?></td>
		<td>
			<input type="text" name="txt_qa_send_address" class="normal_textbox" style="width:99%"  value="<?php echo $v_address;?>" optional="<? echo CONST_QA_SEND_ADDRESS_OPTIONAL; ?>" onKeyDown="change_focus(document.f_dsp_single_qa_question_for_sending,this)">
		</td>
		<td class="normal_label"><?php echo CONST_QA_SENDER_TEL_LABEL;?></td>
		<td >
			<input type="text" name="txt_qa_send_tel" class="normal_textbox"  style="width:98%"  maxlength="15" value=""  optional="<? echo CONST_QA_SEND_TEL_OPTIONAL; ?>" onKeyDown="change_focus(document.f_dsp_single_qa_question_for_sending,this)">
		</td>
	</tr>
	<tr>
		<td class="normal_label"><?php echo CONST_QA_SENDER_EMAIL_LABEL;?></td>
		<td>
			<input type="text"  name="txt_qa_send_email" class="normal_textbox" style="width:99%" value="<?php echo $v_email;?>" optional="<? echo CONST_QA_SEND_EMAIL_OPTIONAL; ?>" isemail="true" message="<?php echo CONST_QA_SEND_EMAIL_MESSAGE;?>" onKeyDown="change_focus(document.f_dsp_single_qa_question_for_sending,this)">
		</td>
		<td class="normal_label"><?php echo CONST_QA_SENDER_WEBSITE_LABEL;?></td>
		<td>
			<input type="text"  name="txt_qa_send_website" class="normal_textbox" style="width:98%" value="" optional="<? echo CONST_QA_SEND_WEBSITE_OPTIONAL; ?>" onKeyDown="change_focus(document.f_dsp_single_qa_question_for_sending,this)">
		</td>
	</tr>
	<tr>
		<td class="normal_label"><?php echo CONST_QA_QUESTION_TITLE_LABEL;?><small class="normal_starmark">*</small></td>
		<td colspan="10">
			<input name="txt_qa_question_title" type="text" class="normal_textbox" style="width:99%" value="" optional="<?php echo CONST_QA_SEND_NAME_OPTIONAL;?>" message="<?php echo CONST_QA_QUESTION_TITLE_MESSAGE;?>" onKeyDown="change_focus(document.f_dsp_single_qa_question_for_sending,this)"  >
		</td>
	</tr>
	<tr>
		<td class="normal_label"><? echo $v_content_qa_lable;?><small class="normal_starmark">*</small></td>
	</tr>
	<tr>
		<td colspan="12">
			<textarea name="txt_detail" class="normal_textarea"  value="" rows="12" style="width:100%" optional="true" message ="<?php echo CONST_ARTICLE_NOTE_MESSAGE;?>"><?php echo $v_question_content; ?></textarea>
			<script language="JavaScript1.2">editor_generate('txt_detail');//Goi ham tao editor trong file editor.js</script>
		</td>
	</tr>
	<td colspan="10" class="normal_label"><? echo CONST_QA_QUESTION_FILE_ATTACH_LABEL;?></td>
	<tr>
		<td colspan="10">
			<!--Bang chua cac file dinh kem-->
			<table width="100%" cellpadding="0" cellspacing="0">
			<col width="10%"><col width="2%"><col width="98%">
				<!--Vong lap hien thi cac file dinh kem se them vao van ban--><?
				for($i=0; $i<CONST_QA_FILE_MAXLENGTH; $i++){
					if ($i<1) {
						$v_str_show="block";
					}else{
						$v_str_show="none";
					}?>
				<tr id="tr_line_new" style="display:<? echo $v_str_show;?>;">
					<td>&nbsp;</td>
					<td><input type="checkbox" name="chk_file_attach_new_id" value="<? echo $i; ?>"></td>
					<td colspan="10">
					<input type="file" name="file_attach<? echo $i;?>" style="width:98%" class="small_textbox" optional="<? echo CONST_QA_ATTACH_FILE_OPTIONAL;?>">
					</td>
				</tr><?
				}?>
				<!--Cac Button Them va Xoa file dinh kem van ban-->
				<tr align="center" style="display:none">
					<td colspan="10"> <a href="<? echo $v_goto_url_for_add_file;?>" class="small_link" ><? echo _CONST_ADD_BUTTON;?></a> &nbsp; <a href="<? echo $v_goto_url_for_delete_file;?>" class="small_link"><? echo _CONST_DELETE_BUTTON;?></a> </td>
				</tr>
			</table>
		</td>
  </tr>
</table>					
<!--bang chua cac button-->
<table width="100%" >
	<tr>
		<td align="center" width="100%" height="40" valign="bottom">
			<input type="button" name="btn_save"  class="normal_button" value="<?php echo CONST_SEND_BUTTON;?>" onClick="btn_save_onclick_qa('SENDING_QA_QUESTION');" onKeyDown="change_focus(document.f_dsp_single_qa_question_for_sending,this)">
			<input type="button" name="btn_back" class="normal_button" value="<?php echo _CONST_BACK_BUTTON;?>" onClick="goback();" onKeyDown="change_focus(document.f_dsp_single_qa_question_for_sending,this)">
		</td>
	</tr>
</table>					
</form>
<script language="javascript">
	sel_onclick_qa(f_dsp_single_qa_question_for_sending.hdn_agency_id,f_dsp_single_qa_question_for_sending.sel_agency);
</script>
